home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48hor2
/
fracts.doc
< prev
next >
Wrap
Text File
|
1995-03-31
|
3KB
|
96 lines
(Comp.sys.handhelds)
Item: 4001 by _kingswood at hpcvbbs.cv.hp.com
Author: [Frank A. Vorstenbosch]
Subj: HP48 Program for Fractional Numbers
Date: Thu Sep 26 1991
Hello NetLand,
The following is a program to calculate with fractions, and allows you
to simplify fractional expressions.
Fractional numbers are entered and processed as symbolics, and as such
can be used in calculations.
The three main programs are:
\->FR Convert two reals to a simple fractional expression
\->FR attempts a simpledivide first, and only when
the result is a real, it retries in 'special-mode',
so that it may be assigned to the divide key.
FR\-> Convert fractional expression to numerator and denominator
SIMPLIFY Simplify a fractional expression
There are two subroutines, recsimp and normalize.
The SIMPLIFY routine currently allows the following operators and
functions, but can easily be expanded to include others.
+ - / * NEG INV SQ ABS IP FP \v/ ^
[Note: \v/ is the square root symbol. -jkh-]
The result of \v/ and ^ must be rational to be allowed, so typing
'1/2^(1/7)' SIMPLIFY
will not work. SIMPLIFY will leave a mess on the stack in this case.
Download the programs to your HP48, then PACK all SYSEVALS to Externals
using Joe Horns program. [No need; I packed it for you. -jkh-]
When you have downloaded the appropriate file to your '48, type the
following for an example:
Enter the numbers 17 and 8:
2: 17 -- numerator
1: 8 -- denominator
Press \-FR:
1: '17/8' -- fraction
Press SIMPLIFY:
1: '2+1/8' -- simplified fraction
Enter the fraction '1/3' by keying in 1 [Enter] 3 \->FR:
2: '2+1/8'
1: '1/3'
Add the two by pressing [+]
1: '2+1/8+1/3'
Duplicate this for later use, then press SIMPLIFY:
2: '2+1/8+1/3'
1: '2+11/24'
Take fractional part, then multiply by typing FP [Enter] [*]
1: '(2+1/8+1/3)*FP(2+11/24)'
Simplify:
1: '1+73/576'
Split into numerator and denominator using FR\->
2: 649
1: 576
And so on, ad nauseam.
If I get enough positive comments on this, I will post a system-RPL
version some time in the future. As well as making things faster, I
may also add more functions.
BTW, AUTOCLOSEIO is a program that is called after each transfer from
within PDL which registers an alarm to exit from Kermit mode, and
performing a CLOSEIO.
Note to Joe Horn: This is PD, and if you like it you may place it on one
of your Goodies' Disks. [Thanx, Frank! -jkh-]